Imports Aricie.DNN.Services.Workers
Imports System.Threading
Imports Aricie.Services

Namespace Aricie.DNN.Caching
    Public Class DistributedCachingModule
        Implements IHttpModule


        Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
            Try
                If Not ReflectionHelper.HasUnrestrictedSecurityPermission Then
                    'otherwise the hostingenvironnement does it itself
                    ReflectionHelper.Instance.DisposeAll()
                End If

            Catch ex As Exception
                DotNetNuke.Services.Exceptions.LogException(ex)
            End Try
        End Sub

        Private Shared _InitDone As Boolean

        Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
            If Not _InitDone Then
                _InitDone = True
                AsyncWorker.Instance.Start("DistributedCaching.Warmup", AddressOf DistributedCachingProviderBase.LoadSettings, 1, True, Nothing)
            End If


        End Sub

    End Class
End Namespace